﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="newproject.aspx.cs" Inherits="Mocola.Net.Web.newproject" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en" dir="ltr">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>CsLand Ams v1.0 - 中新置地档案管理系统</title>
    <meta name="description" content="CsLand Ams v1.0 - 中新置地档案管理系统" />
    <meta http-equiv="X-UA-Compatible" content="IE=7" />

    <link rel="stylesheet" href="css/content.css" type="text/css" />
    <link rel="stylesheet" href="css/ui.css" type="text/css" />
    <link rel="stylesheet" href="css/sys.css" type="text/css" />
   	<link rel="stylesheet" href="css/table.css" type="text/css" />
   	
   	<link rel="stylesheet" media="screen" href="css/vlaCal-v2.1.css" type="text/css" />
	<link rel="stylesheet" media="screen" href="css/vlaCal-v2.1-adobe_cs3.css" type="text/css" />
	<link rel="stylesheet" media="screen" href="css/vlaCal-v2.1-apple_widget.css" type="text/css" />
	<link rel="stylesheet" href="scripts/formcheck/theme/classic/formcheck.css" type="text/css" media="screen" />
	
    <!--[if IE]>
	    <script type="text/javascript" src="scripts/excanvas-compressed.js"></script>	
	    <style type="text/css"> html { overflow: auto; } </style>	
    <![endif]-->
    	
    <script type="text/javascript" src="scripts/mootools-1.2-core.js"></script>
    <script type="text/javascript" src="scripts/mootools-1.2-more.js"></script>	
    <script type="text/javascript" src="scripts/mocha.js"></script>
    <script type="text/javascript" src="scripts/mocola-funs.js"></script>
    <script type="text/javascript" src="scripts/vlaCal-v2.1-compressed.js"></script>
    <script type="text/javascript" src="scripts/vlaCal-v2.1-clientside.js"></script>
    <script type="text/javascript" src="scripts/formcheck/lang/cn.js"> </script>
    <script type="text/javascript" src="scripts/formcheck/formcheck.js"> </script>
</head>
<body>
    <form id="frmNewProject" action="javascript:submitFrmNewProject()">
    <div style="padding:5px;">
    <table class="mytable" cellspacing="0" summary="菜单栏" style="width:100%">
      <tr>
        <th scope="row" class="specalt"><input id="btnSave1" class="btnzc submit" value="保存项目" type="submit" /></th>
      </tr>
    </table>
    <table class="mytable" cellspacing="0" summary="新增项目表单" style="width:100%;margin-top:5px;">
      <tr>
        <th scope="row" class="spec">
        
            <div class="title1">填写项目基本信息：</div>
            <div class="frmline1">
                <label class="label2">1. 项目性质：</label>
                <select name="Xmxz1" id="objXmxz1">
                    <option value="0">新建</option>
                    <option value="1">改建</option>
                    <option value="2">扩建</option>
                    <option value="3">迁移</option>
                    <option value="4">恢复</option>
                </select> -
                <select name="Xmxz2" id="objXmxz2">
                    <option value="0">自建</option>
                    <option value="1">代建</option>
                </select> - 
                   <!-- BEGIN: [#6] -->
                <select name="Xmxz3" id="objXmxz3">
                    <option value="0">住宅</option>
                    <option value="1">酒店</option>
                    <option value="2">商业</option>                    
                     <option value="3">厂房</option>
                    <option value="4">写字楼</option>
                    <option value="5">自定义</option>
                </select> 
                  <!-- END: [#6] -->
                自定义:
                <input type="text" name="XmxzZdy" id="objXmxzZdy" class="inputbox" value="" />
            </div>
            
            <div class="frmline1">
                <label class="label2">2. 结构类型：</label>
                <input type="text" name="Jglx" id="objJglx" class="inputbox" value="" />
            </div>
            
            <div class="frmline1">
                <label class="label2">3. 项目名称：</label>
                <input type="text" class="inputbox" value="" name="Xmmc" style="margin-bottom:3px" id="objXmmc" readonly />
                <div class="onShow" style="margin-left:165px">项目名称由下面任意一项中填写:</div>
                <div style="clear:both">
                    <label class="label2"></label>
                    <input type="text" class="inputbox" value="" name="Zdh" id="objZdh" />
                    <input type="text" class="inputbox" value="" name="Dkm" id="objDkm"/>
                    <input type="text" class="inputbox" value="" name="Anming" id="objAnming"/>
                </div>
                <div style="clear:both">
                    <label class="label2"></label>
                    <input type="radio" id="nRdoXmmc1" class="redio1" name="nRdoXmmc" value="1" checked style="float:left"/><label for="nRdoXmmc1" class="rdolabel">宗地号</label>
                    <label style="line-height: 28px; width: 100px; float: left;"></label>
                    <input type="radio" id="nRdoXmmc2" class="redio1" name="nRdoXmmc" value="2" style="float:left"/><label for="nRdoXmmc2" class="rdolabel">地块名</label>
                    <label style="line-height: 28px; width: 100px; float: left;"></label>
                    <input type="radio" id="nRdoXmmc3" class="redio1" name="nRdoXmmc" value="3" style="float:left"/><label for="nRdoXmmc3" class="rdolabel">案　名</label>
                </div>
                <div style="clear:both">
                    <label class="label2"></label>
                    <input type="text" class="inputbox" value="" name="Cym1" id="objCym1"/>
                    <input type="text" class="inputbox" value="" name="Cym2" id="objCym2"/>
                </div>
                <div style="clear:both">
                    <label class="label2"></label>
                    <input type="radio" id="nRdoXmmc4" class="redio1" name="nRdoXmmc" value="4" style="float:left"/><label for="nRdoXmmc4" class="rdolabel">曾用名一</label>
                    <label style="line-height: 28px; width: 85px; float: left;"></label>
                    <input type="radio" id="nRdoXmmc5" class="redio1" name="nRdoXmmc" value="5" style="float:left"/><label for="nRdoXmmc5" class="rdolabel">曾用名二</label>
                </div>
                 
            </div>
            
            <div class="frmline1">
                <label class="label2">4. 项目时间：</label>
                (1).开工时间:<input type="text" id="objStartTime" name="Kgtime" class="inputbox validate['digit[2000,3000]']" value="" style="width:80px;" />年<input type="text" id="txtKgtime-m" name="Kgtime-m" class="inputbox validate['digit[1,12]']" value="" style="width:50px;" />月<input type="text" id="objSDay" name="Kgtime-d" class="inputbox validate['digit[1,31]']" value="" style="width:30px;" />日
            </div>
            <div class="frmline2">
                <label class="label2"></label>
                (2).竣工时间:<input type="text" id="objEndTime" name="Jgtime" class="inputbox validate['digit[2009,3000]']" value="" style="width:80px;" />年<input type="text" id="txtEndTime-m" name="Jgtime-m" class="inputbox validate['digit[1,12]']" value="" style="width:50px;" />月<input type="text" id="objEDay" name="Jgtime-d" class="inputbox validate['digit[1,31]']" value="" style="width:30px;" />日
            </div>
            
            <div class="frmline1">
                <label class="label2">5. 项目状态：</label>
                <div style="line-height:30px">
                    <select name="Xmzt" id="objXmzt" >
                        <option value="0">进行中</option>
                        <option value="1">已竣工</option>
                    </select>
                </div>
                
            </div>
            
            <div class="frmline1">
                <label class="label2">6. 项目建筑面积：</label>(1).占地面积:<input id="objZdmj" name="Zdmj" type="text" class="inputbox validate['required','digit']" value="0" style="width:50px;margin-left:28px;"/>
            </div>
            <div class="frmline2">
                <label class="label2"></label>(2).地上建筑面积:<input id="objDsjzmj" name="Dsjzmj" type="text" class="inputbox validate['required','digit']" value="0" style="width:50px;"/>
            </div>
            <div class="frmline2">
                <label class="label2"></label>(3).地下建筑面积:<input id="objDxjzmj" name="Dxjzmj" type="text" class="inputbox validate['required','digit']" value="0" style="width:50px;"/>
            </div>
            <div class="frmline2">
                <label class="label2"></label>(4).总建筑面积:<input id="objZjzmj" name="Zjzmj" type="text" class="inputbox validate['required','digit']" value="0" style="width:50px;margin-left:14px;"/>
            </div>
            <div class="frmline2">
                <label class="label2"></label>(5).计容面积:<input id="objJrmj" name="Jrmj" type="text" class="inputbox validate['required','digit']" value="0" style="width:50px;margin-left:28px;"/>
            </div>
            
            <div class="frmline1">
                <label class="label2">7. 项目投资企业：</label>
                <textarea id="objXmtzqy" name="Xmtzqy" class="inputbox" style="width:450px;height:90px"></textarea>
            </div>
               <!-- BEGIN: [#6] -->
            <div class="frmline1">
                <label class="label2">8. 单位：</label>
                施工单位:
            </div>   
               <!-- END: [#6] -->
            <div class="frmline2">
                <label class="label2"></label>
                <textarea id="objSgdw" name="Sgdw" class="inputbox" style="width:450px;height:60px"></textarea>
            </div>         
            <div class="frmline2">
                <label class="label2"></label>
                设计单位:
            </div>
            <div class="frmline2">
                <label class="label2"></label>
                <textarea id="objSjdw" name="Sjdw" class="inputbox" style="width:450px;height:60px"></textarea>
            </div>
            <div class="frmline2">
                <label class="label2"></label>
                监理单位:
            </div>
            <div class="frmline2">
                <label class="label2"></label>
                <textarea id="objJldw" name="Jldw" class="inputbox" style="width:450px;height:60px"></textarea>
            </div>
            
            <div class="frmline1">
                <label class="label2">9. 项目地址：</label>
                <textarea id="objXmdz" name="Xmdz" class="inputbox" style="width:450px;height:80px"></textarea>
            </div>
            
            <div class="frmline1">
                <label class="label2">10. 小组成员名单：</label>
               <input id="btnXmxz" type="button" value="管理" class="btnzc" onclick="projectGroupManagement();" />
            </div>
            
            <div class="frmline1">
                <label class="label2">11. 备注：</label>
                <textarea id="objBeizhu" name="Beizhu" class="inputbox" style="width:450px;height:80px"></textarea>
            </div>
            
        </th>
      </tr>
    </table>
    <table class="mytable" cellspacing="0" summary="菜单栏" style="width:100%;margin-top:5px;">
      <tr>
        <th scope="row" class="specalt"><input id="btnSave2" class="btnzc submit" value="保存项目" type="submit" /></th>
      </tr>
    </table>
    </div>
    </form>
    <script type="text/javascript">
    var fchkNewProject = null;
    var RqUrl = 'ajax/AddProject.aspx';
    var objFocus = null;

    window.addEvent('domready', function() {
        fchkNewProject = new FormCheck('frmNewProject');

        if (gup('id') != null) {
            RqUrl = 'ajax/UpdateProject.aspx?id=' + gup('id');
            $('btnSave1').value = '更新项目';
            $('btnSave2').value = '更新项目';
        } else {
            $('btnXmxz').disabled = true;
            $('btnXmxz').value = "编辑项目时才允许设置项目小组";
        }
    });

    function submitFrmNewProject() {
        //alert(0);return;
        var reqXmmc = false;
        
        if ($('nRdoXmmc1').checked) {
            objFocus = $('objZdh');
            if ($('objZdh').value != '') { $('objXmmc').value = $('objZdh').value; reqXmmc = true; }
        } else if ($('nRdoXmmc2').checked) {
            objFocus = $('objDkm');
            if ($('objDkm').value != '') { $('objXmmc').value = $('objDkm').value; reqXmmc = true; }
        } else if ($('nRdoXmmc3').checked) {
            objFocus = $('objAnming');
            if ($('objAnming').value != '') { $('objXmmc').value = $('objAnming').value; reqXmmc = true; }
        } else if ($('nRdoXmmc4').checked) {
            objFocus = $('objCym1');
            if ($('objCym1').value != '') { $('objXmmc').value = $('objCym1').value; reqXmmc = true; }
        } else if ($('nRdoXmmc5').checked) {
            objFocus = $('objCym2');
            if ($('objCym2').value != '') { $('objXmmc').value = $('objCym2').value; reqXmmc = true; }
        }

        if (!reqXmmc) {
            alert("您必须在宗地号、地块名、案名、曾用名中选择一项进行录入！");
            setTimeout('objFocus.focus()', 200);
            return;
        }
        
        var reqValues = new Request.HTML({url:RqUrl,
		    onSuccess: function(html) {
		        $('btnSave1').disabled = true;
		        window.parent.$('mainPanel_iframe').src = window.parent.$('mainPanel_iframe').src;
		        alert(html.item(0).nodeValue);
			    window.parent.MochaUI.notification("正在更新项目类列表..."); 
			    window.parent.MochaUI.updateContent({
			        element:  window.parent.$('left-panel'),
			        loadMethod: 'iframe',
			        url: 'left-projects.aspx'
		        });
		    },
		    onFailure: function() {
			    window.parent.MochaUI.notification('表单提交失败！');;
		    }
	    }).post($('frmNewProject'));
    }
    function projectGroupManagement()
    {        
       new window.parent.MochaUI.Window({
        id: 'projectGroupManagement',
        title: '项目小组成员管理',
        loadMethod: 'iframe',
        contentURL: 'projectgroup.aspx?id='+gup("id"),
        width: 600,
        height:500,
        resizable:false
    });
    }
    
    if(gup('id')!=null) {
        window.parent.MochaUI.notification('正在读取数据...');
    	
	    var jsonRequest = new Request.JSON({url: "ajax/GetProject.aspx?" + (new Date()).getTime(), onComplete: function(person){
            setData(person.Moc_Project);
        }}).get({'id': gup('id'), 'status': 'update'});
    }
    
    function setData(oData) {
        oData.each(function(dat) {
            $('objXmxz1').value = dat.Character1;
            $('objXmxz2').value = dat.Character2;
            $('objXmxz3').value = dat.Character3;

            $('objXmxzZdy').value = dat.CharacterZdy;
            $('objJglx').value = dat.Structure;

            $('objXmmc').value = dat.Name;
            $('objZdh').value = dat.PlotName;
            $('objDkm').value = dat.PlaceName;
            $('objAnming').value = dat.CaseName;
            $('objCym1').value = dat.OldName1;
            $('objCym2').value = dat.OldName2;

            var sDate = dat.StartTime;
            var eDate = dat.EndTime;
            $('objStartTime').value = sDate.substring(0, sDate.indexOf('-'));
            $('txtKgtime-m').value = sDate.substring(sDate.indexOf('-') + 1, sDate.lastIndexOf('-'));
            $('objSDay').value = sDate.substring(sDate.lastIndexOf('-') + 1, sDate.length);
            $('objEndTime').value = eDate.substring(0, eDate.indexOf('-'));
            $('txtEndTime-m').value = eDate.substring(eDate.indexOf('-') + 1, eDate.lastIndexOf('-'));
            $('objEDay').value = eDate.substring(eDate.lastIndexOf('-') + 1, eDate.length);
            $('objXmzt').value = dat.State;

            $('objZdmj').value = dat.PlaceArea;
            $('objDsjzmj').value = dat.OvergroundArea;
            $('objDxjzmj').value = dat.BlewgroundArea;
            $('objZjzmj').value = dat.TotalArea;
            $('objJrmj').value = dat.JrArea;

            $('objXmtzqy').value = dat.Corps;
            $('objSgdw').value = dat.ConstructUnit;
            $('objSjdw').value = dat.DesignUnit;
            $('objJldw').value = dat.IntendanceUnit;

            $('objXmdz').value = dat.Address;
            $('objBeizhu').value = dat.Remark;

            var nSelRdoXmmc = dat.NameChiose;
            $('nRdoXmmc' + nSelRdoXmmc).checked = true;

            window.parent.MochaUI.notification('数据读取完毕...');
        });
    }
    </script>
</body>
</html>
